package com.serviceprovider.business.module.sp.transaction.model;

//~--- JDK imports ------------------------------------------------------------

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * This class is used to store the search's criteria for finding a transaction
 * @author mrduongnv@gmail.com
 *
 */
public class TransactionCriteria {
    private List<Integer> payeesId = new ArrayList<Integer>();
    private Date          dateFrom;
    private Date          dateTo;
    private Integer       providerId;
    private Integer       transStatusId;

    public void setProviderId(Integer providerId) {
        this.providerId = providerId;
    }

    public Integer getProviderId() {
        return providerId;
    }

    public void setDateFrom(Date dateFrom) {
        this.dateFrom = dateFrom;
    }

    public Date getDateFrom() {
        return dateFrom;
    }

    public void setDateTo(Date dateTo) {
        this.dateTo = dateTo;
    }

    public Date getDateTo() {
        return dateTo;
    }

    public void setPayeesId(Object objId) {
        if (objId instanceof Object[]) {
            payeesId = new ArrayList<Integer>();

            for (Object id : ((Object[]) objId)) {
                payeesId.add(Integer.parseInt(String.valueOf(id)));
            }
        } else if (objId instanceof Integer) {
            payeesId = Arrays.asList((Integer) objId);
        } else if (objId instanceof String) {
            payeesId = Arrays.asList(Integer.parseInt((String) objId));
        }
    }

    public void setPayeesId(List<Integer> payeesId) {
        this.payeesId = payeesId;
    }

    public List<Integer> getPayeesId() {
        return payeesId;
    }

    public void setTransStatusId(Integer transStatusId) {
        this.transStatusId = transStatusId;
    }

    public Integer getTransStatusId() {
        return transStatusId;
    }
}



